# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CustomJobSpec do
  @moduledoc """
  Represents the spec of a CustomJob.

  ## Attributes

  *   `baseOutputDirectory` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GcsDestination.t`, *default:* `nil`) - The Cloud Storage location to store the output of this CustomJob or HyperparameterTuningJob. For HyperparameterTuningJob, the baseOutputDirectory of each child CustomJob backing a Trial is set to a subdirectory of name id under its parent HyperparameterTuningJob's baseOutputDirectory. The following Vertex AI environment variables will be passed to containers or python modules when this field is set: For CustomJob: * AIP_MODEL_DIR = `/model/` * AIP_CHECKPOINT_DIR = `/checkpoints/` * AIP_TENSORBOARD_LOG_DIR = `/logs/` For CustomJob backing a Trial of HyperparameterTuningJob: * AIP_MODEL_DIR = `//model/` * AIP_CHECKPOINT_DIR = `//checkpoints/` * AIP_TENSORBOARD_LOG_DIR = `//logs/`
  *   `enableDashboardAccess` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether you want Vertex AI to enable access to the customized dashboard in training chief container. If set to `true`, you can access the dashboard at the URIs given by CustomJob.web_access_uris or Trial.web_access_uris (within HyperparameterTuningJob.trials).
  *   `enableWebAccess` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether you want Vertex AI to enable [interactive shell access](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) to training containers. If set to `true`, you can access interactive shells at the URIs given by CustomJob.web_access_uris or Trial.web_access_uris (within HyperparameterTuningJob.trials).
  *   `experiment` (*type:* `String.t`, *default:* `nil`) - Optional. The Experiment associated with this job. Format: `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}`
  *   `experimentRun` (*type:* `String.t`, *default:* `nil`) - Optional. The Experiment Run associated with this job. Format: `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}-{experiment-run-name}`
  *   `models` (*type:* `list(String.t)`, *default:* `nil`) - Optional. The name of the Model resources for which to generate a mapping to artifact URIs. Applicable only to some of the Google-provided custom jobs. Format: `projects/{project}/locations/{location}/models/{model}` In order to retrieve a specific version of the model, also provide the version ID or version alias. Example: `projects/{project}/locations/{location}/models/{model}@2` or `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is specified, the "default" version will be returned. The "default" version alias is created for the first version of the model, and can be moved to other versions later on. There will be exactly one default version.
  *   `network` (*type:* `String.t`, *default:* `nil`) - Optional. The full name of the Compute Engine [network](/compute/docs/networks-and-firewalls#networks) to which the Job should be peered. For example, `projects/12345/global/networks/myVPC`. [Format](/compute/docs/reference/rest/v1/networks/insert) is of the form `projects/{project}/global/networks/{network}`. Where {project} is a project number, as in `12345`, and {network} is a network name. To specify this field, you must have already [configured VPC Network Peering for Vertex AI](https://cloud.google.com/vertex-ai/docs/general/vpc-peering). If this field is left unspecified, the job is not peered with any network.
  *   `persistentResourceId` (*type:* `String.t`, *default:* `nil`) - Optional. The ID of the PersistentResource in the same Project and Location which to run If this is specified, the job will be run on existing machines held by the PersistentResource instead of on-demand short-live machines. The network and CMEK configs on the job should be consistent with those on the PersistentResource, otherwise, the job will be rejected.
  *   `protectedArtifactLocationId` (*type:* `String.t`, *default:* `nil`) - The ID of the location to store protected artifacts. e.g. us-central1. Populate only when the location is different than CustomJob location. List of supported locations: https://cloud.google.com/vertex-ai/docs/general/locations
  *   `reservedIpRanges` (*type:* `list(String.t)`, *default:* `nil`) - Optional. A list of names for the reserved ip ranges under the VPC network that can be used for this job. If set, we will deploy the job within the provided ip ranges. Otherwise, the job will be deployed to any ip ranges under the provided VPC network. Example: ['vertex-ai-ip-range'].
  *   `scheduling` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Scheduling.t`, *default:* `nil`) - Scheduling options for a CustomJob.
  *   `serviceAccount` (*type:* `String.t`, *default:* `nil`) - Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. If unspecified, the [Vertex AI Custom Code Service Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) for the CustomJob's project is used.
  *   `tensorboard` (*type:* `String.t`, *default:* `nil`) - Optional. The name of a Vertex AI Tensorboard resource to which this CustomJob will upload Tensorboard logs. Format: `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
  *   `workerPoolSpecs` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1WorkerPoolSpec.t)`, *default:* `nil`) - Required. The spec of the worker pools including machine type and Docker image. All worker pools except the first one are optional and can be skipped by providing an empty value.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :baseOutputDirectory =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GcsDestination.t() | nil,
          :enableDashboardAccess => boolean() | nil,
          :enableWebAccess => boolean() | nil,
          :experiment => String.t() | nil,
          :experimentRun => String.t() | nil,
          :models => list(String.t()) | nil,
          :network => String.t() | nil,
          :persistentResourceId => String.t() | nil,
          :protectedArtifactLocationId => String.t() | nil,
          :reservedIpRanges => list(String.t()) | nil,
          :scheduling =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Scheduling.t() | nil,
          :serviceAccount => String.t() | nil,
          :tensorboard => String.t() | nil,
          :workerPoolSpecs =>
            list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1WorkerPoolSpec.t()) | nil
        }

  field(:baseOutputDirectory,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GcsDestination
  )

  field(:enableDashboardAccess)
  field(:enableWebAccess)
  field(:experiment)
  field(:experimentRun)
  field(:models, type: :list)
  field(:network)
  field(:persistentResourceId)
  field(:protectedArtifactLocationId)
  field(:reservedIpRanges, type: :list)
  field(:scheduling, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Scheduling)
  field(:serviceAccount)
  field(:tensorboard)

  field(:workerPoolSpecs,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1WorkerPoolSpec,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CustomJobSpec do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CustomJobSpec.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CustomJobSpec do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
